using UnityEngine;
using System.Collections;

public class RTSCameraControls : MonoBehaviour {
	public int MoveSpeed = 500;
	public int RotationSpeed = 30;
	
	private Transform myTransform;
	
	// Use this for initialization
	void Start () {
		myTransform = transform;
	}
	
	// Update is called once per frame
	void Update () {
		if (Input.GetKey(KeyCode.W))
		{
			myTransform.position +=  new Vector3(myTransform.forward.x, 0, myTransform.forward.z) * 10 *  MoveSpeed * Time.deltaTime;
		}
		if (Input.GetKey(KeyCode.A))
		{
			myTransform.position +=  -new Vector3(myTransform.right.x, 0, myTransform.right.z) * 10 *  MoveSpeed * Time.deltaTime;
		}
		if (Input.GetKey(KeyCode.S))
		{
			myTransform.position +=  -new Vector3(myTransform.forward.x, 0, myTransform.forward.z) * 10 * MoveSpeed * Time.deltaTime;
		}
		if (Input.GetKey(KeyCode.D))
		{
			myTransform.position +=  new Vector3(myTransform.right.x, 0, myTransform.right.z) * 10 *  MoveSpeed * Time.deltaTime;
		}
		if (Input.GetKey(KeyCode.Q))
		{
			myTransform.RotateAround(myTransform.forward, Vector3.up, 10 * RotationSpeed * Time.deltaTime);
		}
		if (Input.GetKey(KeyCode.E))
		{
			myTransform.RotateAround(myTransform.forward, Vector3.up, -10 * RotationSpeed * Time.deltaTime);
		}
		if (Input.GetAxis("Mouse ScrollWheel") < 0) // back
        {
            myTransform.position -= myTransform.forward;
        }
        if (Input.GetAxis("Mouse ScrollWheel") > 0) // forward
        {
            myTransform.position += myTransform.forward;
        }
	}
}
